package com.five.sbgroup5job.service.impl;
//吴楠
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.five.sbgroup5job.entity.VipUser;
import com.five.sbgroup5job.mapper.VipUserMapper;
import com.five.sbgroup5job.service.VipUserService;
import com.five.sbgroup5job.vo.VipUserVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author 86173
* @description 针对表【vip_user】的数据库操作Service实现
* @createDate 2024-11-08 14:39:43
*/
@Service
public class VipUserServiceImpl extends ServiceImpl<VipUserMapper, VipUser>
    implements VipUserService {

    @Resource
    private VipUserMapper vipUserMapper;

    @Override
    public List<VipUser> vipUserList() {
        return vipUserMapper.selectList(null);
    }


    //添加
    @Override
    public String vipAdd(VipUserVo vipUserVo) {
        VipUser vipUser = new VipUser();
        vipUser.setId(vipUserVo.getId());
        vipUser.setNetName(vipUserVo.getNetName());
        vipUser.setRealName(vipUserVo.getRealName());
        vipUser.setSex(vipUserVo.getSex());
        vipUser.setAge(vipUserVo.getAge());
        vipUser.setContact(vipUserVo.getContact());
        vipUser.setAddress(vipUserVo.getAddress());
        int result = vipUserMapper.insert(vipUser);
        if(result>0){
            return "添加成功";
        }else{
            return "添加失败";
        }

    }

    //更新
    @Override
    public String vipUpdate(VipUserVo vipUserVo) {

        VipUser vipUser = new VipUser();
        vipUser.setId(vipUserVo.getId());
        vipUser.setRealName(vipUserVo.getRealName());
        int result = vipUserMapper.updateById(vipUser);
        if(result>0){
            return "更新成功";
        }else{
            return "更新失败";
        }
    }

       //删除用户
    @Override
    public String vipDelete(VipUserVo vipUserVo) {

        int result = vipUserMapper.deleteById(vipUserVo.getId());
        int result1 = vipUserMapper.deleteById(vipUserVo.getId());
        int result2 = vipUserMapper.deleteById(vipUserVo.getId());
        int result3 = vipUserMapper.deleteById(vipUserVo.getId());
        if(result>0){
            return "删除成功";
        }else{
            return "删除失败";
        }
    }

}




